package com.liruan.rest.exception;

import com.liruan.rest.service.result.ResultCode;
import com.liruan.rest.service.result.ResultCodeAware;

/**
 * 附带错误码的业务异常，减少大量为表征不同错误而构建的异常类
 *
 */
public class BusinessException extends RuntimeException implements ResultCodeAware
{

	/**
	 * 
	 */
	private static final long serialVersionUID = -5396143039570283309L;
	private ResultCode resultCode;

	public BusinessException(ResultCode resultCode)
	{
		super();
		this.resultCode = resultCode;
	}

	public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, ResultCode resultCode)
	{
		super(message, cause, enableSuppression, writableStackTrace);
		this.resultCode = resultCode;
	}

	public BusinessException(String message, Throwable cause, ResultCode resultCode)
	{
		super(message, cause);
		this.resultCode = resultCode;
	}

	public BusinessException(String message, ResultCode resultCode)
	{
		super(message);
		this.resultCode = resultCode;
	}

	public BusinessException(Throwable cause, ResultCode resultCode)
	{
		super(cause);
		this.resultCode = resultCode;
	}

	@Override
	public ResultCode getResultCode()
	{
		return resultCode;
	}

}
